package com.sugar.psych.assessment.module.business.controller.app.usertreeholeclock.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.sugar.psych.assessment.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 树洞打卡新增/修改 Request VO")
@Data
public class AppUserTreeHoleClockSaveReqVO {

    @Schema(description = "打卡类型（0睡觉打卡 1起床打卡）", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "打卡类型不能为空")
    private Boolean type;

    @Schema(description = "打卡时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "打卡时间不能为空")
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime clockTime;

    @Schema(description = "备注", example = "你说的对")
    private String remark;

}